<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">

    <title>Multi-level Offcanvas Demo</title>
</head>

<body>
    <div class="offcanvas offcanvas-end" tabindex="-1" id="firstOffcanvas">
        <div class="offcanvas-header">
            <h5 class="offcanvas-title">Project history</h5>
            <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas"></button>
        </div>
        <div class="offcanvas-body">
            <p>project histories</p>
            <button type="button" class="btn btn-primary" id="openSecondOffcanvas">Project Detail</button>
        </div>
    </div>

    <div class="offcanvas offcanvas-end" tabindex="-1" id="secondOffcanvas">
        <div class="offcanvas-header">
            <h5 class="offcanvas-title">Project Detail</h5>
            <button type="button" class="btn-close text-reset" data-bs-dismiss="offcanvas"></button>
        </div>
        <div class="offcanvas-body">
            <p>This is the project detail.</p>
        </div>
    </div>

    <button type="button" class="btn btn-primary" data-bs-toggle="offcanvas" data-bs-target="#firstOffcanvas">Open Project Histories</button>

    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.min.js"></script>

    <script>
        let openSecondOffcanvasButton = document.getElementById('openSecondOffcanvas');
        openSecondOffcanvasButton.addEventListener('click', function () {
            let firstOffcanvas = new bootstrap.Offcanvas(document.getElementById('firstOffcanvas'));
            let secondOffcanvas = new bootstrap.Offcanvas(document.getElementById('secondOffcanvas'));

            firstOffcanvas.hide();
            secondOffcanvas.show();
        });
    </script>
</body>
</html>